package com.crm.system.controller.csd.followManager;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhPageInfo;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.qo.csd.followManager.ClueFollowQO;
import com.crm.model.vo.csd.followManager.ClueFollowVO;
import com.crm.system.service.csd.followManager.CsdClueFollowService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yincuimei
 * @Date 2021/11/15 11:15
 */
@RestController
@RequestMapping("/csd/csdClueFollow")
@Slf4j
public class CsdClueFollowController {
    @Autowired
    private CsdClueFollowService clueFollowService;

    /**
     * (客服部)跟进管理-》跟进记录
     * @author yincuimei
     * @return
     */
    @PostMapping("/selectClueFollowPageList")
    public DataResponse selectClueFollowPageList(@RequestParam(value = "pageIndex") Integer pageIndex,
                                                 @RequestParam(value = "pageSize") Integer pageSize,
                                                 @RequestParam(value = "sort" , required = false) String sort,
                                                 @RequestParam(value = "sortOrder" , required = false) String sortOrder,
                                                 ClueFollowQO clueFollowQO){
        try {
            DhPageInfo<ClueFollowVO> clueFollowContractVOList = clueFollowService.selectClueFollowVOList(clueFollowQO, pageIndex, pageSize, sort, sortOrder);
            return new DhResponse(ResponseCodeEnum.OK.getResponseCode(), clueFollowContractVOList);
        } catch (Exception e) {
            log.error("csdClueFollow selectClueFollowPageList error:" , e);
            return new DhResponse(ResponseCodeEnum.ERROR.getResponseCode());
        }
    }
}
